/**
 * 
 */
package cc.rico.jms.topic.listener;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author rico 2016年8月2日
 *
 */
public class TopicListener implements MessageListener {
	private static final Logger logger = LoggerFactory.getLogger(TopicListener.class);

	/* (non-Javadoc)
	 * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
	 */
	@Override
	public void onMessage(Message message) {
		try {
			if(message instanceof TextMessage) {
				logger.info("TopicListener.onMessage.message={}", ((TextMessage)message).getText());
			} else {
				logger.info("TopicListener.onMessage.message={}", message);
			}
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}
}
